package Day1;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class PetTest {
    public static void main(String[] args) {
        Set<Pet> set=new HashSet<>();
        set.add(new Pet("花花","狗"));
        set.add(new Pet("草草","猫"));
        set.add(new Pet("树树","鼠"));

        Pet pet=new Pet("花花","鸟");
        set.add(pet);
        Iterator<Pet> iterator = set.iterator();
        while (iterator.hasNext()){
            Pet next = iterator.next();
            System.out.println(next);
        }
        System.out.println("------------------");

        for (Pet p:set){
            System.out.println(p);
        }


    }
}
